package com.lyw.db.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.lyw.db.entites.Writer

@Dao
interface WriterDao {

    //模糊
    @Query("SELECT * FROM writer WHERE name LIKE :keyWord || '%'")
    fun getWriterByKeyWord(keyWord:String): List<Writer>?

    @Query("SELECT * FROM writer WHERE id=:id")
    fun getWriterById(id:Int): Writer

    @Query("SELECT * FROM writer")
    fun getAllWriters(): List<Writer>

    @Insert
    fun insertAll(vararg writers: Writer)
}